package org.mspring.platform.web.spring.converter;

import java.util.Date;

import org.mspring.platform.utils.DateUtils;
import org.springframework.core.convert.converter.Converter;

/**
 * @author Gao Youbo
 * @since 2012-7-24
 */
public class DateConverter implements Converter<String, Date> {

    @Override
    public Date convert(String dateString) {
        if (org.apache.commons.lang3.StringUtils.isNotBlank(dateString)) {
            return DateUtils.parse(dateString);
        }
        return new Date();
    }

}
